<!DOCTYPE html>
<html>
 <head> 
  <meta charset="UTF-8" /> 
  <title>新增接口</title> 
  <link rel="stylesheet" href="../../../assets/js/layui/css/layui.css" media="all" /> 
  <link rel="stylesheet" href="../../../assets/css/global.css" media="all" /> 
  <link rel="stylesheet" href="../../../assets/js/font-awesome/css/font-awesome.min.css" /> 
 </head> 
 <body> 
  <div class="admin-main"> 
   <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;"> 
    <legend>接口基本信息配置</legend> 
   </fieldset> 
   <form id="add_form" class="layui-form"> 
    <div class="layui-form-item"> 
     <label class="layui-form-label">接口名称</label> 
     <div class="layui-input-block"> 
      <input type="text" name="name" placeholder="接口名称" lay-verify="required" class="layui-input" /> 
     </div> 
    </div> 
    <div class="layui-form-item"> 
     <label class="layui-form-label">请求方法</label> 
     <div class="layui-input-block"> 
      <select name="httpType" lay-filter="httpType"> <option value="POST">POST</option> <option value="GET">GET</option> </select> 
     </div> 
    </div> 
    <div class="layui-form-item"> 
     <label class="layui-form-label">请求路径</label> 
     <div class="layui-input-block"> 
      <input type="text" name="uri" placeholder="接口地址,如:/user/add" class="layui-input" /> 
     </div> 
    </div> 
    <div class="layui-form-item"> 
     <label class="layui-form-label">关联数据源</label> 
     <div class="layui-input-block"> 
      <select id="moduleId" name="datasourceId" lay-verify="required" asnycselect="/api/dsconfig/options" lay-filter="datasource"> <option value="">请选择数据源</option> </select> 
     </div> 
    </div> 
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;"> 
     <legend>接口操作配置</legend> 
    </fieldset> 
    <div id="action_config_line" class="layui-form-item"> 
     <div class="layui-inline"> 
      <label class="layui-form-label">添加操作</label> 
      <div class="layui-input-inline" style="width: 200px;"> 
       <input type="text" id="actionName" placeholder="操作名称,可不填" lay-verify="required" class="layui-input" /> 
      </div> 
     </div> 
     <div class="layui-inline"> 
      <div class="layui-input-inline" style="width: 135px;"> 
       <select lay-filter="dbaction"> <option value="">选择操作类型</option> <option value="insert">INSERT</option> <option value="update">UPDAE</option> <option value="delete">DELETE</option> <option value="select">SELECT</option> </select> 
      </div> 
     </div> 
     <div class="layui-inline"> 
      <div class="layui-input-inline" style="width: 135px;"> 
       <select id="table_select" lay-filter="table"> <option value="">选择表</option> </select> 
      </div> 
     </div> 
     <div class="layui-inline" show-on="select" style="display: none;"> 
      <div class="layui-input-inline" style="width: 100px;"> 
       <input type="button" class="layui-btn layui-btn-normal" action="selectConfig" value="配置查询字段" /> 
      </div> 
     </div> 
     <div class="layui-inline" show-on="insert" style="display: none;"> 
      <div class="layui-input-inline" style="width: 100px;"> 
       <input type="button" class="layui-btn layui-btn-normal" action="insertConfig" value="配置插入字段" /> 
      </div> 
     </div> 
     <div class="layui-inline" show-on="update" style="display: none;"> 
      <div class="layui-input-inline" style="width: 100px;"> 
       <input type="button" class="layui-btn layui-btn-normal" action="updateConfig" value="配置更新字段" /> 
      </div> 
     </div> 
     <div class="layui-inline" show-on="select|update|delete" style="display: none;"> 
      <div class="layui-input-inline" style="width: 80px;"> 
       <input type="button" class="layui-btn layui-btn-normal" action="whereConfig" value="配置条件" /> 
      </div> 
     </div>  
     <div class="layui-form-item  layui-form-text"> 
      <div class="layui-inline"> 
       <label class="layui-form-label">SQL表达式</label> 
       <div class="layui-input-inline" style="width: 520px;"> 
        <textarea id="sqlEditer" placeholder="手动输入SQL语句或者通过界面配置" class="layui-textarea"></textarea> 
       </div> 
       <div class="layui-input-inline" style="width: 100px;"> 
         <input type="text" id="resultName" placeholder="结果属性名" lay-verify="required" class="layui-input" /> 
       </div> 
       <div class="layui-input-inline" style="width: 100px;"> 
         <select id="expectResult" asnycselect="/api/apiconfig/validatorOptions">
          <option value="">期望结果</option>  
        </select> 
       </div>
       <div class="layui-input-inline" style="width: 120px;"> 
         <input type="text" id="unexpectMsg" placeholder="错误提示信息" lay-verify="required" class="layui-input" /> 
       </div>
       <div class="layui-input-inline" style="width: 60px;"> 
        <input type="button" id="add_action_btn" class="layui-btn layui-btn-warm" value="添加" /> 
       </div> 
       <div class="layui-input-inline" style="width: 60px; padding-top: 15px;"> 
        <a href="./help.html" target="_blank"><i style="color: #FF5722;text-decoration:underline;font-size: 12px;">查看帮助</i></a>
       </div>
      </div> 
     </div> 
     <table class="layui-table" lay-size="sm" style="margin-left: 20px;width: 98%;"> 
      <thead> 
       <tr> 
        <th width="100">操作步骤</th> 
        <th>执行SQL</th> 11
        <th width="100">结果属性名</th> 
        <th width="80">期望结果</th> 
        <th width="80">错误提示</th> 
       </tr> 
      </thead> 
      <tbody id="apiActionList">  
      </tbody> 
     </table> 
    </div> 
    <div class="layui-form-item"> 
     <div class="layui-input-block"> 
      <input type="button" id="save_btn" class="layui-btn layui-btn-normal" value="保存" /> 
      <input type="reset" class="layui-btn layui-btn-primary" value="重置" /> 
     </div> 
    </div> 
   </form> 
  </div> 
  <div id="configdialog" style="display:none;"> 
   <form id="configForm" class="layui-form" action="" style="padding: 20px;" lay-filter="configForm"></form> 
  </div>  
  <script type="text/javascript" src="/assets/js/layui/layui.js"></script> 
  <script id="configDialogTpl" type="text/html">
     {{#  layui.each(d.columns, function(index, item){ }}
     <div class="layui-form-item">
    <div class="layui-inline">
      <div class="layui-input-inline" style="width: 150px;">
        <input type="checkbox" value="{{ item.name }}" lay-skin="primary" title="{{ item.name }}"  lay-filter="column">
      </div>
      <div class="layui-form-mid" style="width: 80px;" show-on="insertConfig|updateConfig">=</div>
      <div class="layui-input-inline" show-on="whereConfig" style="width: 80px;">
        <select id="{{ item.name }}_1">
        <option value="=">等于</option>
        <option value="<>">不等于</option>
        <option value=">">大于</option>
        <option value="<">小于</option>
        <option value=">=">大于等于</option>
        <option value="<=">小于等于</option>
      </select>
      </div>
      <div class="layui-input-inline" show-on="insertConfig|whereConfig|updateConfig" style="width: 120px;">
        <input type="text" value="{{ item.variableExpr }}" id="{{ item.name }}_2" class="layui-input">
      </div>
      <div class="layui-input-inline" show-on="updateConfig|whereConfig" style="width: 80px;">
        <input type="checkbox" lay-skin="primary" value="{{ item.name }}" title="必填" lay-filter="requireOpt">
      </div>
    </div>
  </div>
     {{#  }); }}
  </script> 
  <script>
	var tables = {};
	layui.config({
		version : "1.0.0",
		base : '/assets/js/modules/'
	}).use('smartapi');
</script> 
 </body>
</html>